<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="myModal">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" >重要提示</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary">确定</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade bs-example-modal-sm s-confirm" tabindex="-1" role="dialog" id="confirm" style="display: none;">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" align="center">重要提示</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>

<div class="tips" id="tips">
    <i class="fa fa-check fa-2x" data-success="fa fa-check fa-2x" data-error="fa fa-times fa-2x"></i>
    <span></span>
</div>
<div class="tips tips-fail" id="tips_error" data-type="error">
    <i class="fa fa-times fa-2x" data-success="fa fa-check fa-2x" data-error="fa fa-times fa-2x"></i>
    <span></span>
</div>

<script type="text/javascript">
    function del(url) {
        confirms(0,{body:"确定要删除吗？"},function () {
            var token = LO.get("token",1);
            location.href=url+"?token="+token;
        });
    }
    function confirms(select,config,fn) {
        (select) || (select="#confirm");
        (config) || (config={});
        var modal = $(select);
        modal.modal();
        var c=modal[0];
        var title = config.title ? config.title : "重要提示";
        var msg = config.body ? config.body : "";
        var btn1_desc = config.btn1 ? config.btn1 : "取消";
        var btn2_desc = config.btn2 ? config.btn2 : "确定";
        var modal_title = $(".modal-title",c);
        var modal_body = $(".modal-body",c);
        var btn1 = $(".btn-white",c);
        var btn2 = $(".btn-primary",c);
        modal_title.html(title);
        modal_body.html(msg);
        btn1.html(btn1_desc);
        btn2.html(btn2_desc);

        btn2.unbind("click mousedown");
        btn2.on("click",function (e) {
            (typeof fn === "function")&&fn(1);
            modal.modal("hide");
        });
    }
    
    function tips(select,message,fn,time) {
        (select) || (select="#tips");
        (message) || (message="操作成功");
        (time) || (time=1500);
        var W=(document.documentElement.clientWidth || window.innerWidth);
        var H=(document.documentElement.clientHeight || window.innerHeight);
        var tips = $(select);
        tips.attr("class","tips tips-action");
        (tips.attr("data-type")==="error") && tips.attr("class","tips tips-action tips-fail");

        $("span",tips[0]).html(message);
        clearTimeout(tips[0].idd);
        clearTimeout(tips[0].iddd);
        tips[0].iddd=setTimeout(function () {
            tips.css({top:((H-tips[0].offsetHeight)/2)+"px",left:((W-tips[0].offsetWidth)/2)+"px",opacity:1});
        },5);
        tips[0].idd=setTimeout(function () {
            tips.css({opacity:""});
            setTimeout(function () {
                tips.attr("class","tips");
                (typeof fn === "function")&&fn();
            },300);
        },time);
    }
    function tips_success(message,fn) {
        (message) || (message = "操作成功");
        tips("#tips",message,fn);
    }
    function tips_fail(message,fn) {
        (message) || (message = "操作失败");
        tips("#tips_error",message,fn);
    }
</script>